﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DataStudio
{
    public delegate void myDelegate1();
    public delegate void myDelegate2(int progress ,string s);

    public partial class WaitForm : Form
    {
        private static WaitForm waitForm = new WaitForm();

        public WaitForm()
        {
            InitializeComponent();
        }

        public static void ShowWaitForm()
        {
            waitForm.ShowDialog();
        }

        public static void CloseWaitForm()
        {
            waitForm.Invoke(new myDelegate1(CloseWaitFormImp));
        }

        public static void CloseWaitFormImp()
        {
            waitForm.Close();
        }

        public static void ShowMessage(int progress, string s)
        {
            waitForm.Invoke(new myDelegate2(ShowMessageImp), progress, s);
        }

        public static void ShowMessageImp(int progress, string s)
        {
            waitForm.label1.Text = s;
            waitForm.progressBar1.Value = progress;
        }
    }
}
